const CopyWebpackPlugin = require("copy-webpack-plugin");
const UglifyJsPlugin = require("uglifyjs-webpack-plugin");

module.exports = {
  mode: "none",
  entry: {
    "autoZipNode.real": "./autoZipNode.real.js",
  },
  output: {
    filename: "[name].js",
    library: "autoZipNode",
    libraryTarget: "umd",
    libraryExport: "default",
    globalObject: "this",
  },
  plugins: [
    // new UglifyJsPlugin({
    //   uglifyOptions: {
    //     output: {
    //       comments: false, // 去掉注释
    //     },
    //     compress: {
    //       drop_console: false,
    //     },
    //   },
    // }),
    new CopyWebpackPlugin({
      patterns: [
        {
          from: "./zip.exe",
          to: "zip.exe",
        },
        {
          from: "./autoZipNode.js",
          to: "autoZipNode.js",
        },
      ],
    }),
  ],
  node: {
    fs: true,
    path: true,
    process: true,
    child_process: true,
  },
  target: "node",
};
